import os
import glob
import fnmatch

# print(os.getcwd())
# print(os.path.join('MyProject', 'AI'))
# print(os.listdir())
'''
for item in os.listdir():
    print(item)
'''
'''
files = os.listdir()
for file in files:
    print(file, os.path.isdir(file))
'''
'''
for file in os.scandir():
    print(file.name, file.path, file.is_dir())
'''
'''
for dirpath, dirnames, filenames in os.walk('./'):
    print(f'find dir: {dirpath}')
    print(filenames)
'''
# print('abc.txt'.startswith('ab'))
# print('abc.txt'.endswith('txt'))

# glob:
'''
print(glob.glob('dem*.py'))
print(glob.glob('demo_??.py'))
print(glob.glob('demo_0[1,3,5].py'))
# 递归任意层文件夹下的txt文件
print(glob.glob('**/*.txt', recursive=True))
'''

# fnmatch:
# print(fnmatch.fnmatch('lesson1.py', 'le*1.py'))

for file in os.scandir():
    print(file.name, file.stat())  # st_size 文件体积 bytes st_atime 文件最近访问时间 st_mtime 文件最近修改时间 st_ctime 创建时间
